/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lostreseditores.persistencia;

import com.lostreseditores.modelo.Examenpreguntas;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author DILOVE
 */
@Stateless
public class ExamenpreguntasFacade extends AbstractFacade<Examenpreguntas> implements ExamenpreguntasFacadeLocal {
    @PersistenceContext(unitName = "DemoDianaPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ExamenpreguntasFacade() {
        super(Examenpreguntas.class);
    }

    @Override
    public List<Examenpreguntas> findAllOrder(int codE, int sesion) {
        String consulta = "select e from Examenpreguntas e where e.examenpreguntasPK.idExamen="+codE+" and e.sesion = "+sesion+" order by e.nropregunta";
        Query query = em.createQuery(consulta);
        return query.getResultList();
    }
    
    
    
}
